﻿@{
    Layout = "~/Views/Shared/_LayoutAdminPage.cshtml";
}



<!-- 正文开始 -->
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-header">清除缓存</div>
        <div class="layui-card-body layui-text  text-center">
            <div class="layui-btn-container" style="margin-top: 15px;">
                <button id="clearTemplateCache" class="layui-btn layui-btn-primary">清除模板缓存</button>
                <button id="ClearMainCache" class="layui-btn layui-btn-primary">清除主页缓存</button>
                <button id="ClearDataCache" class="layui-btn layui-btn-primary">清除数据缓存</button>
                <button id="clearDiyPageCache" class="layui-btn layui-btn-primary">清除自定义页面缓存</button>

            </div>
        </div>
    </div>


    
</div>


<script>
    layui.use(['layer', 'form', 'table', 'util', 'admin', 'xmSelect', 'notice'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var util = layui.util;
        var admin = layui.admin;
        var xmSelect = layui.xmSelect;
        var notice = layui.notice;

        $("#clearTemplateCache").click(function () {
            parent.layui.admin.confirm('确认删除吗？', function (index) {
                var loadIndex = layer.load(2);
                $.post('/api/admin/ClearCache/clearTamplateCache', {}, function (res) {
                    parent.layer.close(index);
                    layer.close(loadIndex);
                    if (res.code == 1) {
                        layer.msg(res.message, { icon: 1 });
                    } else {
                        layer.msg(res.message, { icon: 2 });
                    }
                }, 'json');
                
            });
        });
        $("#clearDiyPageCache").click(function () {
            parent.layui.admin.confirm('确认删除吗？', function (index) {
                var loadIndex = layer.load(2);
                $.post('/api/admin/ClearCache/ClearDiyPageCache', {}, function (res) {
                    parent.layer.close(index);
                    layer.close(loadIndex);
                    if (res.code == 1) {
                        layer.msg(res.message, { icon: 1 });
                    } else {
                        layer.msg(res.message, { icon: 2 });
                    }
                }, 'json');

            });
        });
        $("#ClearMainCache").click(function () {
            parent.layui.admin.confirm('确认删除吗？', function (index) {
                var loadIndex = layer.load(2);
                $.post('/api/admin/ClearCache/ClearMainCache', {}, function (res) {
                    parent.layer.close(index);
                    layer.close(loadIndex);
                    if (res.code == 1) {
                        layer.msg(res.message, { icon: 1 });
                    } else {
                        layer.msg(res.message, { icon: 2 });
                    }
                }, 'json');

            });
        });


        $("#ClearDataCache").click(function () {
            parent.layui.admin.confirm('确认删除吗？', function (index) {
                var loadIndex = layer.load(2);
                $.post('/api/admin/ClearCache/ClearDataCache', {}, function (res) {
                    parent.layer.close(index);
                    layer.close(loadIndex);
                    if (res.code == 1) {
                        layer.msg(res.message, { icon: 1 });
                    } else {
                        layer.msg(res.message, { icon: 2 });
                    }
                }, 'json');

            });
        });

});</script>